#include<stdio.h>
#include<stdlib.h>
typedef struct Node{
    int data;
    struct Node *next;
}Node,*List;
int main()
{
    int k;
    scanf("%d",&k);
    List H,p;
    H = (List)malloc(sizeof(Node));
    H->next = NULL;
    int n;
    while(scanf("%d",&n)&&n>=0)
    {
        p = (List)malloc(sizeof(Node));
        p->data = n;
        p->next = H->next;
        H->next = p;
    }
    for(int i=0;i<k;i++)
        H = H->next;
    if(H)
        printf("%d\n",H->data);
    else
        printf("NULL\n");
    return 0;
}
//求链式线性表的倒数第K项